package com.foreknow.elm.controller;

import com.foreknow.elm.po.Business;
import com.foreknow.elm.service.BusinessService;
import com.foreknow.elm.service.impl.BusinessServiceImpl;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

public class BusinessController {
    /**
     * 根据orderTypeId查询商家信息
     * @param request
     * @return
     */
    public Object listBusinessByOrderTypeId(HttpServletRequest request) {
//        获取请求参数
        Integer orderTypeId = Integer.valueOf(request.getParameter("orderTypeId"));
        BusinessService service = new BusinessServiceImpl();
        List<Business> list = service.listBusinessByOrderTypeId(orderTypeId);
        return list;
    }

    /**
     * 根据商家编号查询商家信息
     * @param request
     * @return
     * @throws Exception
     */
    public Object getBusinessById(HttpServletRequest request){
        String or =request.getParameter("businessId");
        Integer businessId=Integer.valueOf(or);
        BusinessService service = new BusinessServiceImpl();
        Business business=service.getBusinessById(businessId);
        return business;

    }
}
